package cn.bdqn.t354.dao;

import cn.bdqn.t354.entity.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.util.List;

@SpringBootTest
@RunWith(SpringRunner.class)
public class UserDaoQueryTester {
    @Resource
    UserDao userDao;

    //1.HQL查询
    @Test
    public void testFindAllUsersByRoleId(){
        List<User> list = userDao.findAllUsersByRoleId(2l);

        for (User user : list) {
            System.out.println(user);
        }
    }

    @Test
    public void testupdateUserByUserId(){
        userDao.updateUserByUserId("dajunjun",20l);
    }

    //2.SQL查询
    @Test
    public void testfindAllUsersByRoleId2(){
        List<User> list = userDao.findAllUsersByRoleId2(2l);

        for (User user : list) {
            System.out.println(user);
        }
    }
    //3.方法名规则查询

    //4.specity动态查询
}
